import { request } from "../../request/index.js";

Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 轮播图数据
    swiperList: [],
    // 导航数组
    catesList: [],
    // 楼层数据
    floorList: [],
  },
  // 页面开始加载就会触发
  onLoad: function (options) {

    this.getSwiperList();
    this.getCateList();
    this.getFloorList();
  },

  // 获取轮播图数据
  getSwiperList() {
    request({
      url: '/home/swiperdata'
    }).then(result => {
      // console.log(result)
      this.setData({
        swiperList: result
      })
    })
  },


  // 获取导航数据分类
  getCateList() {
    request({
      url: '/home/catitems'
    }).then(result => {
      // console.log(result)
      this.setData({
        catesList: result
      })
      // console.log(this.data.catesList)
    })
  },


    // 获取楼层数据
    getFloorList() {
      request({
        url: '/home/floordata'
      }).then(result => {
        // console.log(result)
        this.setData({
          floorList: result
        })
        console.log(this.data.floorList)
      })
    },


})